package com.xxxx;

import org.apache.flink.api.java.ExecutionEnvironment;
import org.apache.flink.configuration.Configuration;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;

public class Hello01FlinkSource {
    public static void main(String[] args) {

        //创建环境
        ExecutionEnvironment environmentBatch = ExecutionEnvironment.createLocalEnvironmentWithWebUI(new Configuration());
        StreamExecutionEnvironment environmentStream = StreamExecutionEnvironment.createLocalEnvironmentWithWebUI(new Configuration());
        //获取数据源(环境决定了读取的数据是有界的还是无界的)
        //DataSource<String> fileSourceBatch = environmentBatch.readTextFile("path");
        //DataStreamSource<String> fileSourceStream = environmentStream.readTextFile("path");

        //获取数据（容器）
        //ArrayList<String> list = Lists.newArrayList("aa", "bb", "cc", "dd", "ee");
        //DataSource<String> collectionSourceBatch = environmentBatch.fromCollection(list);
        //DataStreamSource<String> collectionSourceStream = environmentStream.fromCollection(list);

        //获取数据源（Socket只能用于流处理）
        //environmentStream.socketTextStream("localhost", 8888);


    }

}
